package com.matrix.app.mvc.project.member.data;

import com.matrix.app.common.enums.Role;
import com.matrix.app.common.enums.Sex;
import com.matrix.framework.core.annotation.validation.Email;
import com.matrix.framework.core.annotation.validation.Length;
import com.matrix.framework.core.annotation.validation.Required;
import jakarta.persistence.*;

import java.io.Serializable;

/**
 * 项目成员持久化对象，对应project_member表
 *
 * Copyright © 海平面工作室 版权所有
 *
 * @Author: Leo
 * @Create: 2025/06/01 15:28
 * @Since 1.0
 */
@Entity
@Table(name = "project_member")
public class MemberPo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Required(message = "姓名必填")
    @Length(min = 3, max = 30, message = "姓名长度必须在3-30之间")
    private String name;

    private String sex;

    private String phone;

    private String role;

    @Required
    @Email
    @Length(min = 5, max = 50)
    private String email;

    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "项目成员信息{" +
                "id=" + id +
                ", 姓名=" + name +
                ", 性别=" + Sex.valueOf(sex).getDescription() +
                ", 电话=" + phone +
                ", 邮箱=" + email +
                ", 角色=" + Role.valueOf(role).getDescription() +
                '}';
    }
}